package com.yxlgateway.gateway.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yxlcommon.common.pojo.RespBean;
import com.yxlcommon.common.pojo.WorkComment;
import com.yxlgateway.service.WorkCommentService;
import com.yxlcommon.common.vo.WorkCommentVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author: yxl
 * @since: 2022-02-15
 **/
@RestController
@RequestMapping("/workComment")
public class WorkCommentController {

    @Autowired
    private WorkCommentService workCommentService;

    @PostMapping("/getAllWorkCommentsByPage")
    public RespBean<IPage<WorkCommentVo>> getAllWorkCommentsByPage(@RequestParam(defaultValue = "1") Integer currentPage,
                                                                   @RequestParam(defaultValue = "10") Integer size,
                                                                   @RequestBody WorkComment workComment){
        return workCommentService.getAllWorkCommentsByPage(currentPage,size,workComment);
    }

    @PostMapping("/changeWorkCommentById")
    public RespBean<Integer> changeWorkCommentById(@RequestBody WorkComment workComment){
        return workCommentService.changeWorkCommentById(workComment);
    }

    @PostMapping("/selectCommentById")
    public RespBean<WorkCommentVo> selectCommentById(@RequestBody WorkCommentVo workCommentVo){
        return workCommentService.selectCommentById(workCommentVo);
    }

    @PostMapping("/adminAddWorkComment")
    public RespBean<Integer> adminAddWorkComment(@RequestBody WorkComment workComment){
        return workCommentService.adminAddComment(workComment);
    }

    @PostMapping("/deleteWorkCommentById")
    public RespBean<Integer> deleteWorkCommentById(@RequestBody WorkComment workComment){
        return workCommentService.deleteWorkCommentById(workComment);
    }
}
